﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:Fluent="clr-namespace:Fluent" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d">
  <Style x:Key="RibbonComboButtonStyle" TargetType="{x:Type Fluent:ToggleButton}">
		<Setter Property="Template" Value="{DynamicResource RibbonComboButtonControlTemplate}"/>
		<Setter Property="Height" Value="66"/>
    <Setter Property="Width" Value="Auto"/>
    <Setter Property="FontSize" Value="{DynamicResource DefaultFontSize}"/>
    <Setter Property="FontFamily" Value="{DynamicResource DefaultFontFamily}"/>
    <Setter Property="Foreground" Value="{DynamicResource DefaultFontBrush}"/>
    <Setter Property="FocusVisualStyle" Value="{DynamicResource ControlStyleEmptyFocus}"/>
	</Style>
	<ControlTemplate x:Key="RibbonComboButtonControlTemplate" TargetType="{x:Type Fluent:ToggleButton}"/>
  <Style TargetType="{x:Type Fluent:ComboBox}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Fluent:ComboBox}">
        	<Border Width="Auto" Background="#00000000" Height="22">
        		<Grid Width="Auto" Height="Auto" Background="#00000000">
        			<Grid.ColumnDefinitions>
        				<ColumnDefinition Width="Auto"/>
        				<ColumnDefinition/>
        			</Grid.ColumnDefinitions>
        			<StackPanel Orientation="Horizontal" Grid.ColumnSpan="1" x:Name="stackPanel" HorizontalAlignment="Left" Margin="0,0,4,0">
        				<Image x:Name="iconImage" Width="16" Height="16" VerticalAlignment="Center" Margin="3,0,0,0" Source="{TemplateBinding Icon}"/>
        				<TextBlock Text="{TemplateBinding Text}" TextWrapping="Wrap" VerticalAlignment="Center" Margin="5,0,0,0" x:Name="textBlock"/>
        			</StackPanel>
				
        			<Border Height="Auto" BorderThickness="1,1,1,1" BorderBrush="{DynamicResource TextBoxBorderBrush}" x:Name="PART_ContentBorder" Background="{DynamicResource TextBoxBackgroundBrush}" Grid.Column="1" Grid.ColumnSpan="1" Width="{TemplateBinding InputWidth}" d:LayoutOverrides="GridBox" HorizontalAlignment="Right">
        				<Grid>
        					<Grid.ColumnDefinitions>
        						<ColumnDefinition Width="*"/>
        						<ColumnDefinition Width="13"/>
        					</Grid.ColumnDefinitions>
        					<Border Grid.ColumnSpan="1" Grid.Column="1" BorderThickness="1,0,0,0" BorderBrush="{DynamicResource TextBoxHoverBorderBrush}" Visibility="Collapsed" x:Name="border1" Background="{DynamicResource TextBoxBackgroundBrush}"/>
        					<Border x:Name="buttonBorder" BorderThickness="1" CornerRadius="0" Background="{DynamicResource TransparentBrush}" BorderBrush="{DynamicResource TransparentBrush}" Height="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Grid.Column="1" Margin="0,-1,-1,-1">
        						<Border x:Name="buttonBorder1" Height="Auto" BorderBrush="{DynamicResource TransparentBrush}" BorderThickness="1" CornerRadius="0" Background="{DynamicResource TransparentBrush}">
        							<Grid Height="Auto">
        								<Rectangle x:Name="rectangle" StrokeThickness="0" Visibility="Collapsed">
        									<Rectangle.Fill>
        										<RadialGradientBrush Center="0.503,1" GradientOrigin="0.503,1" RadiusY="0.202">
        											<GradientStop Color="#7FFFFFFF" Offset="0"/>
        											<GradientStop Offset="1"/>
        										</RadialGradientBrush>
        									</Rectangle.Fill>
        								</Rectangle>
        								<Path x:Name="path" HorizontalAlignment="Center" Margin="0,0,0,0" Stretch="Fill" Stroke="{x:Null}" StrokeThickness="0" Data="M0,0L1,1 2,0z" Fill="#FF000000" Width="5" Height="3" VerticalAlignment="Center"/>
        							</Grid>
        						</Border>
        					</Border>
        					<TextBox HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Text="{TemplateBinding SelectedItem}" TextWrapping="NoWrap" BorderThickness="0,0,0,0" x:Name="PART_TextBox" IsReadOnly="{TemplateBinding IsReadOnly}" Background="{DynamicResource TextBoxBackgroundBrush}"/>
        					<Fluent:GalleryItem x:Name="PART_GalleryItem" Margin="0" Content="" Grid.ColumnSpan="1" Visibility="Collapsed" IsHitTestVisible="False" Focusable="False"/>
        					<Image x:Name="PART_FakeImage" Grid.ColumnSpan="1" Visibility="Collapsed" IsHitTestVisible="False" Stretch="None"/>
        				</Grid>
        			</Border>
        		</Grid>
        	</Border>
        	<ControlTemplate.Triggers>
                        <Trigger Property="Icon" Value="{x:Null}">
                            <Setter Property="Visibility" TargetName="iconImage" Value="Collapsed"/>
                        </Trigger>
                        <Trigger Property="InputWidth" Value="NaN">
                            <Setter Property="HorizontalAlignment" TargetName="PART_ContentBorder" Value="Stretch"/>                            
                </Trigger>
                <Trigger Property="Size" Value="Middle">
                    <Setter Property="Visibility" TargetName="textBlock" Value="Collapsed"/>
        		</Trigger>
        		<Trigger Property="Size" Value="Small">
        			<Setter Property="Visibility" TargetName="stackPanel" Value="Collapsed"/>
        		</Trigger>
        		<Trigger Property="IsEditable" Value="False">
        			<Setter Property="Visibility" TargetName="PART_GalleryItem" Value="Visible"/>
        			<Setter Property="Visibility" TargetName="PART_TextBox" Value="Collapsed"/>
        		</Trigger>
        		<Trigger Property="IsEnabled" Value="False">
        			<Setter Property="Opacity" TargetName="path" Value="0.5"/>
        			<Setter Property="IsEnabled" TargetName="PART_TextBox" Value="False"/>
        			<Setter Property="Background" TargetName="PART_ContentBorder" Value="{DynamicResource TextBoxDisabledBackgroundBrush}"/>
        			<Setter Property="BorderBrush" TargetName="PART_ContentBorder" Value="{DynamicResource TextBoxDisabledBorderBrush}"/>
        			<Setter Property="BorderBrush" TargetName="border1" Value="{DynamicResource TextBoxDisabledBackgroundBrush}"/>
        			<Setter Property="BorderBrush" TargetName="PART_TextBox" Value="{DynamicResource TextBoxDisabledBackgroundBrush}"/>
                            <Setter Property="Opacity" TargetName="iconImage" Value="0.5"/>
                            <Setter Property="Opacity" TargetName="textBlock" Value="0.5"/>
                            <Setter Property="Effect" TargetName="iconImage">
                                <Setter.Value>
                                    <Fluent:GrayscaleEffect/>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
        		<!--<Trigger Property="IsOpen" Value="True">
        			<Setter Property="IsHitTestVisible" TargetName="PART_DownButton" Value="False"/>              
        		</Trigger>-->
        		<Trigger Property="IsMouseOver" Value="True">
        			<Setter Property="Visibility" TargetName="border1" Value="Visible"/>
        			<Setter Property="BorderBrush" TargetName="PART_ContentBorder" Value="{DynamicResource TextBoxHoverBorderBrush}"/>
					<Setter Property="Background" TargetName="PART_TextBox" Value="{DynamicResource TextBoxHoverBackgroundBrush}"/>
        			<Setter Property="Background" TargetName="border1" Value="{DynamicResource TextBoxHoverBackgroundBrush}"/>
        			<Setter Property="Background" TargetName="PART_ContentBorder" Value="{DynamicResource TextBoxHoverBackgroundBrush}"/>
        		</Trigger>
				
        		<Trigger Property="IsKeyboardFocusWithin" Value="True">
        			<Setter Property="Visibility" TargetName="border1" Value="Visible"/>
        			<Setter Property="BorderBrush" TargetName="PART_ContentBorder" Value="{DynamicResource TextBoxHoverBorderBrush}"/>
        			<Setter Property="Background" TargetName="PART_TextBox" Value="{DynamicResource TextBoxHoverBackgroundBrush}"/>
        			<Setter Property="Background" TargetName="border1" Value="{DynamicResource TextBoxHoverBackgroundBrush}"/>
        			<Setter Property="Background" TargetName="PART_ContentBorder" Value="{DynamicResource TextBoxHoverBackgroundBrush}"/>
        		</Trigger>
				
        		<Trigger Property="IsOpen" Value="True">
        			<Setter Property="BorderBrush" TargetName="buttonBorder" Value="{DynamicResource ButtonPressedOuterBorderBrush}"/>
        			<Setter Property="Background" TargetName="buttonBorder" Value="{DynamicResource ButtonPressedOuterBackgroundBrush}"/>
        			<Setter Property="Background" TargetName="buttonBorder1" Value="{DynamicResource ButtonPressedInnerBackgroundBrush}"/>
        			<Setter Property="BorderBrush" TargetName="buttonBorder1" Value="{DynamicResource ButtonPressedInnerBorderBrush}"/>
        		</Trigger>
						
        		<MultiTrigger>
        			<MultiTrigger.Conditions>
        				<Condition Property="IsMouseOver" Value="True" SourceName="buttonBorder"/>
        				<Condition Property="IsOpen" Value="False"/>
        			</MultiTrigger.Conditions>
        			<Setter Property="BorderBrush" TargetName="buttonBorder1" Value="{DynamicResource ButtonHoverInnerBorderBrush}"/>
        			<Setter Property="Background" TargetName="buttonBorder1" Value="{DynamicResource ButtonHoverInnerBackgroundBrush}"/>
        			<Setter Property="Background" TargetName="buttonBorder" Value="{DynamicResource ButtonHoverOuterBackgroundBrush}"/>
        			<Setter Property="BorderBrush" TargetName="buttonBorder" Value="{DynamicResource ButtonHoverOuterBorderBrush}"/>
        			<Setter Property="Visibility" TargetName="rectangle" Value="Visible"/>
        		</MultiTrigger>
        		<MultiTrigger>
        			<MultiTrigger.Conditions>
        				<Condition Property="IsKeyboardFocusWithin" Value="True" SourceName="PART_TextBox"/>
        				<Condition Property="IsOpen" Value="False"/>
        			</MultiTrigger.Conditions>
        			<Setter Property="BorderBrush" TargetName="buttonBorder1" Value="{DynamicResource ButtonHoverInnerBorderBrush}"/>
        			<Setter Property="Background" TargetName="buttonBorder1" Value="{DynamicResource ButtonHoverInnerBackgroundBrush}"/>
        			<Setter Property="Background" TargetName="buttonBorder" Value="{DynamicResource ButtonHoverOuterBackgroundBrush}"/>
        			<Setter Property="BorderBrush" TargetName="buttonBorder" Value="{DynamicResource ButtonHoverOuterBorderBrush}"/>
        		</MultiTrigger>			
        	</ControlTemplate.Triggers>
          
        </ControlTemplate>
      </Setter.Value>
    </Setter>
	<Setter Property="FocusVisualStyle" Value="{DynamicResource ControlStyleEmptyFocus}"/>
  </Style>
</ResourceDictionary>